home *** CD-ROM | disk | FTP | other *** search
/ An Introduction to Progr…l Basic 6.0 (4th Edition) / An Introduction to Programming using Visual Basic 6.0.iso / PROGRAMS / CH6 / 6-1-4.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-18  |  2.1 KB  |  71 lines

  1. VERSION 5.00
  2. Begin VB.Form frmInterest 
  3.    Caption         =   "7% Interest"
  4.    ClientHeight    =   1845
  5.    ClientLeft      =   1230
  6.    ClientTop       =   1770
  7.    ClientWidth     =   4005
  8.    BeginProperty Font 
  9.       Name            =   "MS Sans Serif"
  10.       Size            =   8.25
  11.       Charset         =   0
  12.       Weight          =   700
  13.       Underline       =   0   'False
  14.       Italic          =   0   'False
  15.       Strikethrough   =   0   'False
  16.    EndProperty
  17.    LinkTopic       =   "Form1"
  18.    PaletteMode     =   1  'UseZOrder
  19.    ScaleHeight     =   1845
  20.    ScaleWidth      =   4005
  21.    Begin VB.TextBox txtAmount 
  22.       Height          =   285
  23.       Left            =   1920
  24.       TabIndex        =   1
  25.       Top             =   240
  26.       Width           =   1095
  27.    End
  28.    Begin VB.PictureBox picWhen 
  29.       Height          =   255
  30.       Left            =   120
  31.       ScaleHeight     =   195
  32.       ScaleWidth      =   3675
  33.       TabIndex        =   3
  34.       Top             =   1440
  35.       Width           =   3735
  36.    End
  37.    Begin VB.CommandButton cmdYears 
  38.       Caption         =   "Years to become a millionaire"
  39.       Default         =   -1  'True
  40.       Height          =   495
  41.       Left            =   120
  42.       TabIndex        =   2
  43.       Top             =   720
  44.       Width           =   3735
  45.    End
  46.    Begin VB.Label lblAmount 
  47.       Caption         =   "Amount Deposited"
  48.       Height          =   495
  49.       Left            =   960
  50.       TabIndex        =   0
  51.       Top             =   120
  52.       Width           =   975
  53.    End
  54. Attribute VB_Name = "frmInterest"
  55. Attribute VB_GlobalNameSpace = False
  56. Attribute VB_Creatable = False
  57. Attribute VB_PredeclaredId = True
  58. Attribute VB_Exposed = False
  59. Private Sub cmdYears_Click()
  60.   Dim balance As Single, numYears As Integer
  61.   'Compute years required to become a millionaire
  62.   picWhen.Cls
  63.   balance = Val(txtAmount.Text)
  64.   numYears = 0
  65.   Do While balance < 1000000
  66.     balance = balance + 0.07 * balance
  67.     numYears = numYears + 1
  68.   Loop
  69.   picWhen.Print "In"; numYears; "years you will have a million dollars."
  70. End Sub
  71.